import Vue from 'vue'
import Vuex from 'vuex'
import cloneDeep from 'lodash/cloneDeep'
import menu from './modules/menu'


Vue.use(Vuex)
const store=() => {
  return new Vuex.Store({
    modules: {
      menu,
    },
    mutations: {
      // 重置vuex本地储存状态
      resetStore (state) {
        Object.keys(state).forEach((key) => {
          state[key] = cloneDeep(init[key])
        })
      }
    },
  })
}
//初始化值
const init=cloneDeep(store.state)
export default store
